<%--
  Created by IntelliJ IDEA.
  User: 17355
  Date: 2019/6/21
  Time: 15:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div>
    <%!
        /**
         * 4、编写一个JSP页面,计算圆的面积和周长，
         * 使用JSP声明定义成员方法 public double getArea(double radius)
         * 和public double getPerimeter(double radius)，
         *使用JSP表达式调用成员方法输出圆的面积和周长
         */
        double PI = 3.14;

        public double getArea(double radius) {

            double area = PI * radius * radius;
            return area;
        }

        public double getPerimeter(double radius) {
            double perimeter = PI * 2 * radius;
            return perimeter;
        }
    %>

    圆的面积为：<%=getArea(10)%>
    <br>
    圆的周长为：<%=getPerimeter(10)%>
</div>
</body>
</html>
